package com.acctrue.zentao.enums;

/**
 * @author: 孙炯炯
 * @since: 2024/9/5
 **/
public enum TaskTypeEnum {
    /**
     * 任务类型
     */
    design("design", "设计", ""),
    devel("devel", "开发—新功能", "feat"),
    devnew("devnew", "开发—优化", "refactor"),
    test("test", "测试", ""),
    doc("doc", "文档", ""),
    study("study", "研究", ""),
    discuss("discuss", "讨论", ""),
    ui("ui", "界面", ""),
    affair("affair", "事务", ""),
    misc("misc", "其他", ""),
    deployment("deployment", "部署", ""),
    implement("implement", "实施", ""),
    needs("needs", "需求", ""),
    travel("travel", "出差", ""),
    operate("operate", "运营", ""),
    planedesign("planedesign", "平面设计", ""),
    NULL("null", "空", ""),

    STYLE("style", "style", "style"),
    CHECK("check", "check", "check"),
    MERGE("merge", "merge", "merge"),

    BUG("bug", "bug", "bug"),
    ;
    private final String value;
    private final String name;
    private final String group;

    public String getValue() {
        return value;
    }

    public String getName() {
        return name;
    }

    public String getGroup() {
        return group;
    }

    TaskTypeEnum(String value, String name, String group) {
        this.value = value;
        this.name = name;
        this.group = group;
    }

    public static String getNameByValue(String value) {
        for (TaskTypeEnum e : TaskTypeEnum.values()) {
            if (e.getValue().equals(value)) {
                return e.name;
            }
        }
        return "";
    }

    public static String getGroupByValue(String value) {
        for (TaskTypeEnum e : TaskTypeEnum.values()) {
            if (e.getValue().equals(value)) {
                return e.getGroup();
            }
        }
        return "";
    }
}
